package com.ruoyi.common.enums;

import java.util.NoSuchElementException;

/**
 * 订单状态枚举
 * 
 * @author: zcy
 * @Date: 2021/1/24
 * @version 0.0.1
 *
 */
public enum OrderStatus {
	/** 未开始:0 */
	ORDER_WAIT_START(Short.valueOf("0")) {
		public String getOrderStatus() {
			return "未开始";
		}
	},
	/** 进行中:1 */
	ORDER_IN_OPERATING(Short.valueOf("1")) {
		public String getOrderStatus() {
			return "进行中";
		}
	},
	/** 已完成:2 */
	ORDER_COMPLETED(Short.valueOf("2")) {
		public String getOrderStatus() {
			return "已完成";
		}
	},
	/** 归档:3 */
	ORDER_IN_FILE(Short.valueOf("3")) {
		public String getOrderStatus() {
			return "归档";
		}
	},
	/**驳回:4 */
	ORDER_REJECT(Short.valueOf("4")) {
		public String getOrderStatus() {
			return "驳回";
		}
	};

	private OrderStatus(Short key) {
		this.key = key;
	}

	private Short key;

	public Short getKey() {
		return this.key;
	}

	public abstract String getOrderStatus();

	public static OrderStatus getOrderStatus(Short code) {
		for (OrderStatus orderStatus : OrderStatus.values()) {
			if (code.equals((orderStatus.getKey())))
				return orderStatus;
		}
		throw new NoSuchElementException(code.toString());
	}
}
